#include <stdio.h>

template <typename T>
class EventList
{
    public:
    
    void addEvent(T* n)
    {
        n->next=nullptr;
        
        if(_head==nullptr) {
            _head=n;
            _root=n;
        }
        if(_tail)
        {
            _tail->next = n; 
        }
        _tail = n;
        
    }
    T* current(){return _head;}
    T* next(){return _head ? _head->next : nullptr;}
    void selectNext(float currentTime) { if(_head && currentTime>=_head->end) _head=_head->next;}
private:
    T* _head=nullptr;
    T* _root=nullptr;
    T* _tail=nullptr;
    
};

